from django.contrib import admin

from vote.models import Subject, Teacher,User
from vote.forms import RegisterForm

# 学科与老师和后台管理
class SubjectAdmin(admin.ModelAdmin):
    list_display = ('no', 'name', 'create_date', 'is_hot')
    ordering = ('no', )


class TeacherAdmin(admin.ModelAdmin):
    list_display = ('no', 'name', 'detail', 'good_count', 'bad_count', 'subject')
    ordering = ('subject', 'no')


admin.site.register(Subject, SubjectAdmin)
admin.site.register(Teacher, TeacherAdmin)

# 用户后台管理

class UserAdmin(admin.ModelAdmin):
    list_display = ('no', 'username', 'password','regdate')
    ordering = ('no', )
    form = RegisterForm         # 与表单绑定
    list_per_page = 10

admin.site.register(User, UserAdmin)